home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)ts.d64
/
1541 backup.c
(
.txt
)
next >
Wrap
Commodore BASIC
|
2007-02-04
|
7KB
|
179 lines
100 PRINT"[147]":POKE56,41:CLR:GOTO185
105 :
110 *********************************
115 * SINGLE DISK BACKUP V1.0 *
120 * *
125 * WRITTEN: 27, JULY 1982 *
130 * AUTHOR : MICHAEL SCHAFF *
135 * *
140 * CONFIGURATION: *
145 * COMPUTER: C64 *
150 * DISK : 1541 *
155 * *
160 * (C) 1982 *
165 * COMMODORE BUSINESS MACHINES *
170 *********************************
175 :
180 :
185 POKE53280,1:REM BORDER COLOR
190 POKE53281,1:REM BACKGROUND COLOR
195 PRINT"" :REM CHARACTER COLOR
200 DI=8 :REM DISK DEVICE NUMBER
205 SP=1389 :REM SCREEN BAR POSITION
210 SB=10496 :REM START BUFFER
215 BP=10496 :REM BUFFER POINTER
220 EB=40960 :REM END BUFFER
225 :
230 :
235 FORA=828TO867:READB:POKEA,B:NEXT
240 DATA 162,2,32,198,255,160,0,32,165,255,153,0,48,200,208,247,32,204,255,96
245 DATA 162,2,32,201,255,160,0,185,0,48,32,168,255,200,208,247,32,204,255,96
250 BL$=" [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]"
255 BL$=BL$+"[157][157][157][157][157][157][157]":DIMBM$(140),C(43):FORA=0TO43:READC(A):NEXT:GOSUB815
260 DATA 32,101,116,117,97,246,234,231,160,21,21,21,21,21,21,21,21,21,21,21,21
265 DATA 21,21,21,21,21,19,19,19,19,19,19,19,18,18,18,18,18,18,17,17,17,17,17
270 PRINT"[147]"SPC(8)"SINGLE DISK BACKUP V1.0"
275 PRINT""SPC(11)"BY MICHAEL SCHAFF"
280 PRINT"[213][192]BACKUP COMMAND[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
285 PRINT"[221] [221]"
290 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
295 PRINT"[213][192]BUFFER[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
300 PRINT"[194] [158] [221]"
305 PRINT"[221] E [167] F [221]"
310 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
315 PRINT"[213][192]DISK[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
320 PRINT"[221] [221]"
325 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
330 PRINT"[213][192]DISK STATUS[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
335 PRINT"[221] [221]"
340 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
345 PRINT"[213][192]EXECUTING[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
350 PRINT"[221] [221]"
355 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
360 PRINT"[213][192]OPERATOR INTERVENTION[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
365 PRINT"[221] [221]"
370 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
375 OP$="ENTER THE PROGRAM OPERATION CODE":GOSUB795:LN=1:DN=7:RT=1
380 GOSUB730:IFB$=""THENB$="B"
385 PO=ASC(B$):IFB$="D"THENOP$="DIRECT BACKUP":GOTO400
390 IFB$<>"B"THEN375
395 OP$="BAM SELECT BACKUP"
400 GOSUB785:OP$="":GOSUB780:OP$="ENTER DISK NAME"
405 GOSUB795:OP$="DESTINATION:":GOSUB790:LN=16:DN=14:RT=17:GOSUB730
410 LN=2:RT=35:IFB$=""THENB$="CBM 1541 BACKUP":OP$=OP$+" "+B$:GOSUB790
415 DN$=B$:PRINT"[145]"SPC(34)",":OP$="ENTER DISK ID NUMBER":GOSUB795
420 GOSUB730:IFB$=""THENB$="64"
425 PRINT"[145]"SPC(35)B$:DI$=B$:POKE198,0
430 BC$="INSERT DESTINATION DISK INTO DRIVE":GOSUB965
435 GOSUB810:OP$="FORMATING DESTINATION DISK":GOSUB780
440 OPEN15,DI,15:INPUT#15,EN$,ED$,ET,ES$:IFEN$="00"THEN450
445 CLOSE15:OP$="":GOSUB780:GOSUB800:OP$="":GOTO405
450 DN$="N0:"+DN$+","+DI$:PRINT#15,DN$:INPUT#15,EN$,ED$,ET$,ES$
455 CLOSE15:GOSUB800:IFEN$<>"00"THEN:OP$="":GOSUB780:GOTO405
460 OP$="":GOSUB780
465 BC$="INSERT SOURCE DISK INTO DRIVE":GOSUB965
480 OP$="READING BAM FROM SOURCE DISK":GOSUB780
485 OPEN15,DI,15:OPEN2,DI,2,"#":PRINT#15,"U1";2;0;18;0:PRINT#15,"B-P:"2;1
490 GET#2,A$:GET#2,A$:GET#2,A$:FORA=1TO140:GET#2,A$:IFA$=""THENA$=CHR$(0)
495 BM$(A)=A$:NEXT:INPUT#15,EN$,ED$,ET$,ES$:IFEN$<>"00"THENSTOP
500 PRINT#15,"B-P";2;144:SN$="":FORA=1TO20:GET#2,A$:SN$=SN$+A$:NEXT
505 CLOSE2:CLOSE15:SN$=LEFT$(SN$,16)+","+RIGHT$(SN$,2)
510 DN$=RIGHT$(DN$,LEN(DN$)-3):A$=LEFT$(DN$,LEN(DN$)-3)+" "
515 DN$=LEFT$(A$,16)+","+RIGHT$(DN$,2):GOSUB800:OP$="SOURCE: "+SN$
520 IFRIGHT$(DN$,2)<>RIGHT$(SN$,2)THEN535
525 OP$="":GOSUB780:GOSUB790:EN$="*3":ED$="BAD ID NUMBER":ET$="00":ES$="00"
530 GOSUB800:BC$="ID NUMBERS ARE NOT UNIQUE":GOSUB965:GOTO100
535 GOSUB790:OP$="":GOSUB780
540 BC$="VERIFY SOURCE DISK FOR BACKUP":GOSUB965
545 IFA$<>"N"THEN555
550 OP$="":GOSUB780:GOSUB790:GOSUB810:GOTO465
555 OP$="READING DATA INTO BUFFER":GOSUB780
560 IFPO=68THENFORA=1TO140:BM$(A)=CHR$(0):NEXT
565 OPEN15,DI,15:OPEN2,DI,2,"#"
570 FORTC=1TO140STEP4:IFC(((TC-1)/4+1)+8)=ASC(BM$(TC))THEN695
575 TR=(TC-1)/4+1:BY=255-ASC(BM$(TC+1))
580 IFBYAND128THENSC=7:GOSUB835
585 IFBYAND64THENSC=6:GOSUB835
590 IFBYAND32THENSC=5:GOSUB835
595 IFBYAND16THENSC=4:GOSUB835
600 IFBYAND8THENSC=3:GOSUB835
605 IFBYAND4THENSC=2:GOSUB835
610 IFBYAND2THENSC=1:GOSUB835
615 IFBYAND1THENSC=0:GOSUB835
620 BY=255-ASC(BM$(TC+2))
625 IFBYAND128THENSC=15:GOSUB835
630 IFBYAND64THENSC=14:GOSUB835
635 IFBYAND32THENSC=13:GOSUB835
640 IFBYAND16THENSC=12:GOSUB835
645 IFBYAND8THENSC=11:GOSUB835
650 IFBYAND4THENSC=10:GOSUB835
655 IFBYAND2THENSC=9:GOSUB835
660 IFBYAND1THENSC=8:GOSUB835
665 BY=255-ASC(BM$(TC+3))
670 IF(BYAND16)ANDC(TR+8)>20THENSC=20:GOSUB835
675 IF(BYAND8)ANDC(TR+8)>19THENSC=19:GOSUB835
680 IF(BYAND4)ANDC(TR+8)>18THENSC=18:GOSUB835
685 IF(BYAND2)ANDC(TR+8)>17THENSC=17:GOSUB835
690 IF(BYAND1)ANDC(TR+8)>16THENSC=16:GOSUB835
695 NEXT:CLOSE2:CLOSE15:OP$="":GOSUB780:OP$="DESTINATION: "+DN$:GOSUB790
700 BC$="INSERT DESTINATION DISK INTO DRIVE":GOSUB965
705 GOSUB955:IFID$=RIGHT$(DN$,2)THENEN$="00":ED$="OK":GOTO715
710 EN$="*1":ED$="SOURCE ID FOUND":ET$="00":ES$="00":GOSUB800:GOTO700
715 GOSUB800:OP$="WRITING DATA FROM BUFFER":GOSUB780:GOSUB910
720 OP$="BACKUP FINISHED":GOSUB780:OP$="":GOSUB810:GOSUB785:GOSUB790
725 BC$="REMOVE DESTINATION DISK FROM DRIVE":GOSUB965:GOTO100
730 B$="":PRINTLEFT$("",DN)SPC(RT)" ";
735 PRINT"[157][168]";:FORA=1TO55:GETA$:IFA$<>""THEN745
740 NEXT:PRINT"[157] ";:FORA=1TO55:IFA$=""THENNEXT:GOTO735
745 IFASC(A$)=13THENPRINT"[157] ":RETURN
746 IFASC(A$)=133THEN100
750 IFASC(A$)<>20THEN765
755 IFLEN(B$)=0THENNEXT:GOTO735
760 B$=LEFT$(B$,LEN(B$)-1):PRINT"[157] [157][157] ";:GOTO735
765 IFA$<" "ORA$>"Z"THENNEXT:GOTO735
770 IFLEN(B$)<LNTHENB$=B$+A$:PRINT"[157]"A$"";:GOTO735
775 NEXT:GOTO735
780 PRINT""BL$OP$:RETURN
785 PRINT""BL$OP$:RETURN
790 PRINT""BL$OP$:RETURN
795 PRINT""BL$OP$:RETURN
800 CLOSE2:CLOSE15:OP$=EN$+", "+ED$+","+ET$+","+ES$
805 PRINT""BL$OP$:RETURN
810 PRINT""BL$:RETURN
815 FORA=SBTOEBSTEP258:POKEA,0:POKEA+1,0:NEXT:BP=SB:RETURN
820 IFBR=0THENPT=PT+1:IFPT>8THENPT=1:SP=SP+1:GOTO830
825 IFBR=1THENPT=PT-1:IFPT<0THENPT=7:SP=SP-1
830 POKESP,C(PT):RETURN
835 BR=0:PRINT#15,"U1:"2;0;TR;SC:PRINT#15,"B-P:"2;0
840 POKEBP,TR:POKEBP+1,SC:BP=BP+2:HI=INT(BP/256):LO=BP-(HI*256):POKE839,LO
845 POKE840,HI:GOSUB820:SYS828:GOSUB820:INPUT#15,EN$,ED$,ET$,ES$
850 IFEN$<>"00"THEN980
855 BP=BP+256:IFBP+256<EBTHENRETURN
860 CLOSE2:CLOSE15:OP$="":GOSUB780:OP$="DESTINATION: "+DN$:GOSUB790
865 BC$="INSERT DESTINATION DISK INTO DRIVE":GOSUB965
870 GOSUB955:IFID$=RIGHT$(DN$,2)THENEN$="00":ED$="OK":GOSUB800:GOTO880
875 EN$="*1":ED$="SOURCE ID FOUND":ET$="00":ES$="00":GOSUB800:GOTO865
880 OP$="WRITING DATA FROM BUFFER":GOSUB780:GOSUB910:GOSUB815:OP$="":GOSUB780
885 OP$="SOURCE: "+SN$:GOSUB790
890 BC$="INSERT SOURCE DISK INTO DRIVE":GOSUB965
895 GOSUB955:IFID$=RIGHT$(SN$,2)THENEN$="00":ED$="OK":GOSUB800:GOTO905
900 EN$="*2":ED$="DESTINATION ID FOUND":ET$="00":ES$="00":GOSUB800:GOTO890
905 OP$="READING DATA INTO BUFFER":GOSUB780:OPEN15,DI,15:OPEN2,DI,2,"#":RETURN
910 BP=SB:OPEN15,DI,15:OPEN2,DI,2,"#":BR=1
915 IF(PEEK(BP)=0ANDPEEK(BP+1)=0)ORBP+256>EBTHENCLOSE15:CLOSE2:RETURN
920 TR=PEEK(BP):SC=PEEK(BP+1):IFTR=18ANDSC=0THEN945
925 PRINT#15,"B-P:"2;0:BP=BP+2:HI=INT(BP/256):LO=BP-(HI*256):POKE856,LO
930 POKE857,HI:GOSUB820:SYS848:GOSUB820:INPUT#15,EN$,ED$,ET$,ES$
935 IFEN$<>"00"THEN980
940 PRINT#15,"U2";2;0;TR;SC:BP=BP+256:GOTO915
945 FORA=0TO15:POKE(BP+146+A),ASC(MID$(DN$,A+1,1)):NEXT:FORA=0TO1
950 POKE(BP+164+A),ASC(MID$(DN$,18+A,1)):NEXT:GOTO925
955 OPEN15,DI,15:OPEN2,DI,2,"#":PRINT#15,"U1";2;0;18;0:PRINT#15,"B-P:"2;162
960 GET#2,A$:GET#2,B$:CLOSE2:CLOSE15:ID$=A$+B$:RETURN
965 OP$=BC$:GOSUB795:FORA=1TO75:GETA$
970 IFA$=""THENNEXT:OP$="":GOSUB795:FORA=1TO75:GETA$:IFA$=""THENNEXT:GOTO965
975 OP$="":GOSUB795:IFA$<>"[133]"THENRETURN
976 GOTO100
980 GOSUB800:OP$="BACKUP INCOMPLETE --- REDO FROM START":GOSUB780
985 GOSUB780:BC$="UN-RECOVERABLE DISK ERROR":GOSUB965:GOTO100